import requests
import json
from PIL import Image
from io import BytesIO
# https://www.modelscope.cn/models/MAILAND/majicflus_v1 这个很好
url = 'https://api-inference.modelscope.cn/v1/images/generations'

payload = {
    'model': 'MAILAND/majicflus_v1',#ModelScope Model-Id,required
    'prompt': 'A golden cat'# required
}
headers = {
    'Authorization': 'Bearer f86e749f-f041-4308-8e7f-1a3cd963a2fe',
    'Content-Type': 'application/json'
}

response = requests.post(url, data=json.dumps(payload, ensure_ascii=False).encode('utf-8'), headers=headers)

response_data = response.json()
image = Image.open(BytesIO(requests.get(response_data['images'][0]['url']).content))
image.save('result_image.jpg')